<template>
	<view class="main">	
	<lb-picker :props='props0' @confirm='confirm0' ref='Picker0' :list='list0'></lb-picker>
	<lb-picker :props='props' @confirm='confirm' ref='Picker1' :list='list'></lb-picker>
	<lb-picker :props='props2' @confirm='confirm2' ref='Picker2' :list='list2'></lb-picker>
		<view class="active_tit">
			<view class="tit">
				担保主体信息
			</view>
		</view>
		<view style="padding-left: 3rem;width: 100%;">

			<ActiveForm ref='GuaranteeType' style="width: 100% !important;" v-if="businessType==1&&appluserType!='1'">
				<radio-group @change="selectGuaranteeType">
					<text style="font-size: 3rem;">将申请企业作为担保：</text>
					<label class="radio" style="font-size: 3rem;">
						<radio value="1" :checked="guaranteeType==1" />是
					</label>
					<label class="radio" style="margin-left: 2rem;font-size: 3rem;">
						<radio value="2" :checked="guaranteeType==2" />否
					</label>
				</radio-group>
				<text v-if="guaranteeType==1"
					style="font-size: 3rem;color: red;margin-left: 2rem;">提示：选择【是】后系统会申请企业作为担保，并签署担保合同</text>
			</ActiveForm>
			<ActiveForm ref='GuaranteeType' style="width: 100% !important;" v-if="businessType==2">
				<radio-group @change="selectGuaranteeType">
					<text style="font-size: 3rem;">将申请人作为担保：</text>
					<label class="radio" style="font-size: 3rem;">
						<radio value="1" :checked="guaranteeType==1" />是
					</label>
					<label class="radio" style="margin-left: 2rem;font-size: 3rem;">
						<radio value="2" :checked="guaranteeType==2" />否
					</label>
				</radio-group>
				<text v-if="guaranteeType==1"
					style="font-size: 3rem;color: red;margin-left: 2rem;">提示：选择【是】后系统会将申请人作为担保，并签署担保合同</text>
			</ActiveForm>
		</view>
		<block v-for="(item,index) in stdOffsurSceneLoanRelation" :key="index+'dbzt'">
			<view class="cut">担保主体{{index+1}}
				<uni-icons class="clear" type="clear"
					@click='stdDel(stdOffsurSceneLoanRelation,item,"stdOffsurSceneLoanRelation")'></uni-icons>
			</view>
			<view class="main" v-if="item.subjectType=='2'">
				<ActiveForm style="width: 100%;" v-if="!item.uuid">
					<view class="active_label">
						<button :disabled='!!item.uuid' @click="chooseImg(item)" size="mini" type="primary">证件识别</button>
					</view>	
				</ActiveForm>
				
				<ActiveForm>
					<view class="active_label">
						主体类型：
					</view>
					<view class="active_input">
						<SelectPicker disabled v-model="item.subjectType" :options="subjectTypeOption"
							placeholder="请选择" />
					</view>
				</ActiveForm>
				
				<ActiveForm required>
					<view class="active_label">
						身份属性：
					</view>
					<view class="active_input">
						<SelectPicker @change='change1($event,index)' :disabled='!!item.uuid'
							v-model="item.ideyAttribute" :options="ideyAttributeOption2" placeholder="请选择" />
					</view>
				</ActiveForm>
				<ActiveForm required>
					<view class="active_label">
						名称：
					</view>
					<view class="active_input">
						<input @blur="userBlur(item)" :disabled='!!item.uuid' type="text" v-model.trim="item.relName" />
					</view>
				</ActiveForm>
				<ActiveForm required>
					<view class="active_label">
						统一社会信用代码：
					</view>
					<view class="active_input">
						<input @blur="entBlur(item)" :disabled='!!item.uuid' maxlength="18" type="text"
							@input="cardCheck($event,item,'idCode')" v-model.trim="item.idCode" />
					</view>
				</ActiveForm>
				<ActiveForm required>
					<view class="active_label">
						证件有效期起始日：
					</view>
					<view class="active_input">
						<view v-if="!item.idCode" >请先输入统一社会信用代码</view>
						<picker v-else style="width: 100%;" mode="date" :value="item.entStartDate"   @change="(o)=>{item.entStartDate=o.target.value}">
						    <view >{{item.entStartDate}}</view>
						</picker>
					</view>
				</ActiveForm>
				<ActiveForm required>
					<view class="active_label">
						证件有效期终止日：
					</view>
					<view class="active_input">
						<view v-if="!item.idCode">请先输入统一社会信用代码</view>
						<picker v-else style="width: 70%;" mode="date" :value="item.entEndDate"   @change="(o)=>{item.entEndDate=o.target.value}">
						    <view >{{item.entEndDate}}</view>
						</picker>
						<button   type="primary" size="mini" @click="()=>{item.entEndDate='长期'}">长期</button>
					</view>
				</ActiveForm>
				<ActiveForm required>
					<view class="active_label">
						实际控制人 ：
					</view>
					<view class="active_input">
						<input :disabled='!!item.uuid' type="text" v-model.trim="item.actPerson" />
					</view>
				</ActiveForm>
				<ActiveForm required>
					<view class="active_label">
						法定代表人 ：
					</view>
					<view class="active_input">
						<input :disabled='!!item.uuid' type="text" v-model.trim="item.legalPerson" />
					</view>
				</ActiveForm>
				<ActiveForm required>
					<view class="active_label">
						法人身份证号码：
					</view>
					<view class="active_input">
						<input  @blur="onBlur(item,'legalIdCode')" :disabled='!!item.uuid' maxlength="18" type="text"
							@input="cardCheck($event,item,'legalIdCode')" v-model.trim="item.legalIdCode" />
					</view>
				</ActiveForm>
				<ActiveForm required>
					<view class="active_label">
						证件有效期起始日：
					</view>
					<view class="active_input">
						<view v-if="!item.legalIdCode" >请先输入法人身份证号码</view>
						<picker v-else style="width: 100%;" mode="date" :value="item.startDate"   @change="(o)=>{item.startDate=o.target.value}">
						    <view >{{item.startDate}}</view>
						</picker>
					</view>
				</ActiveForm>
				<ActiveForm required>
					<view class="active_label">
						证件有效期终止日：
					</view>
					<view class="active_input">
						<view v-if="!item.legalIdCode">请先输入法人身份证号码</view>
						<picker v-else style="width: 70%;" mode="date" :value="item.endDate"   @change="(o)=>{item.endDate=o.target.value}">
						    <view >{{item.endDate}}</view>
						</picker>
						<button   type="primary" size="mini" @click="()=>{item.endDate='长期'}">长期</button>
					</view>
				</ActiveForm>
				<ActiveForm required>
					<view class="active_label">
						法人手机号：
					</view>
					<view class="active_input">
						<input :disabled='!!item.uuid' type="number" maxlength="11" v-model.trim="item.telephone" />
					</view>
				</ActiveForm>
				<ActiveForm>
					<view class="active_label">
						邮箱：
					</view>
					<view class="active_input">
						<input placeholder="此邮箱用于电子合同送达。" :disabled='!!item.uuid'  v-model.trim="item.email" />
					</view>
				</ActiveForm>
				<ActiveForm required>
					<view class="active_label">
						主营业务：
					</view>
					<view class="active_input">
						<input   v-model="item.mainBusiness" />
					</view>
				</ActiveForm>
				
				<ActiveForm required>
					<view class="active_label">
						关联人持股比例：
					</view>
					<view class="active_input">
						<input :disabled='!!item.uuid' type="text" v-model="item.relatedShareProportion" />
					</view>
				</ActiveForm>
				<ActiveForm required>
					<view class="active_label">
						营业地址：
					</view>
					<view class="active_input">
						<RegionPicker :value="address(item.famAddress)" :options="region"
							@change="((o)=>{item.famAddress=o.value.toString()})" />
					</view>
				</ActiveForm>
				<ActiveForm required>
					<view class="active_label">
						营业详细地址：
					</view>
					<view class="active_input">
						<input :disabled='!!item.uuid' type="text" v-model="item.detailAddress" />
					</view>
				</ActiveForm>
				
				
			</view>
			<view class="main" v-if="item.subjectType=='1'">
				<ActiveForm style="width: 100%;" v-if="!item.uuid">
					<view class="active_label">
						<button :disabled='!!item.uuid' @click="openOcr(item)" size="mini" type="primary">身份证识别</button>
					</view>	
				</ActiveForm>
				<ActiveForm>
					<view class="active_label">
						主体类型：
					</view>
					<view class="active_input">
						<SelectPicker disabled v-model="item.subjectType" :options="subjectTypeOption"
							placeholder="请选择" />
					</view>
				</ActiveForm>
				
				<ActiveForm>
					<view class="active_label">
						身份属性：
					</view>
					<view class="active_input">
						<SelectPicker :disabled='!!item.uuid' @change='select($event,index)'
							v-model="item.ideyAttribute" :options="ideyAttributeOption" placeholder="请选择" />
					</view>
				</ActiveForm>
				<ActiveForm>
					<view class="active_label">
						名称：
					</view>
					<view class="active_input">
						<input @blur="userBlur(item)" :disabled='!!item.uuid' type="text" v-model.trim="item.relName" />
					</view>
				</ActiveForm>
				
				<ActiveForm required ref='idType'>
					<view class="active_label">
						证件类型：
					</view>
					<view class="active_input">
						<SelectPicker :disabled='!!item.uuid' v-model="item.idType" :options="maritalIdTypeOptions" placeholder="请选择" />
					</view>
				</ActiveForm>
				<ActiveForm required>
					<view class="active_label">
						身份证号码：
					</view>
					<view class="active_input">
						<input :disabled='!!item.uuid' maxlength="18" @blur="onBlur(item,'idCode')" type="text"
							@input="cardCheck($event,item,'idCode')" v-model.trim="item.idCode" />
					</view>
				</ActiveForm>
				<ActiveForm required>
					<view class="active_label">
						证件有效期起始日：
					</view>
					<view class="active_input">
						<view v-if="!item.idCode" >请先输入证件号码</view>
						<picker v-else style="width: 100%;" mode="date" :value="item.startDate"   @change="(o)=>{item.startDate=o.target.value}">
						    <view >{{item.startDate}}</view>
						</picker>
					</view>
				</ActiveForm>
				<ActiveForm required>
					<view class="active_label">
						证件有效期终止日：
					</view>
					<view class="active_input">
						<view v-if="!item.idCode">请先输入证件号码</view>
						<picker v-else style="width: 70%;" mode="date" :value="item.endDate"   @change="(o)=>{item.endDate=o.target.value}">
						    <view >{{item.endDate}}</view>
						</picker>
						<button   type="primary" size="mini" @click="()=>{item.endDate='长期'}">长期</button>
					</view>
				</ActiveForm>
				<ActiveForm required>
					<view class="active_label">
						手机号码：
					</view>
					<view class="active_input">
						<input :disabled='!!item.uuid' type="number" maxlength="11" v-model.trim="item.telephone" />
					</view>
				</ActiveForm>
				<ActiveForm>
					<view class="active_label">
						邮箱：
					</view>
					<view class="active_input">
						<input placeholder="此邮箱用于电子合同送达。" :disabled='!!item.uuid'  v-model.trim="item.email" />
					</view>
				</ActiveForm>
				<!-- <ActiveForm>
					<view class="active_label">
						其他年收入（元） ：
					</view>
					<view class="active_input">
						<mInput maxlength="16" v-model="item.otherIncomeYear" />
					</view>
				</ActiveForm> -->
				<ActiveForm required>
					<view class="active_label">
						年收入（元） ：
					</view>
					<view class="active_input">
						<mInput maxlength="16" v-model="item.incomeYear" />
					</view>
				</ActiveForm>
				<ActiveForm required>
					<view class="active_label">
						收入类型：
					</view>
					<view class="active_input">
						<SelectPicker :disabled='!!item.uuid' v-model="item.incomeType" :options="incomeTypeArr" placeholder="请选择" />
					</view>
				</ActiveForm>
				
				
				<ActiveForm required>
					<view class="active_label">
						家庭住址：
					</view>
					<view class="active_input">
						<RegionPicker :value="address(item.famAddress)" :options="region"
							@change="((o)=>{item.famAddress=o.value.toString()})" />
					</view>
				</ActiveForm>
				<ActiveForm required>
					<view class="active_label">
						家庭详细住址：
					</view>
					<view class="active_input">
						<input type="text" v-model="item.detailAddress" />
					</view>
				</ActiveForm>
				
				
				<ActiveForm v-if="item.incomeType==='20'" required>
					<view class="active_label">
						工作单位：
					</view>
					<view class="active_input">
						<input :disabled='!!item.uuid' type="text" v-model.trim="item.jobName" />
					</view>
				</ActiveForm>
				<ActiveForm v-if="item.incomeType==='20'" required>
					<view class="active_label">
						工作单位地址：
					</view>
					<view class="active_input">
						<input type="text" v-model="item.orgAddress" />
					</view>
				</ActiveForm>
				<ActiveForm v-if="item.incomeType==='20'" required>
					<view class="active_label">
						职位：
					</view>
					<view class="active_input">
						<input :disabled='!!item.uuid' type="text" v-model="item.jobDuty" />
					</view>
				</ActiveForm>
				
				<ActiveForm v-if="item.incomeType==='10'" required>
					<view class="active_label">
						经营企业名称：
					</view>
					<view class="active_input">
						<input  type="text" v-model.trim="item.companyName" />
					</view>
				</ActiveForm>
				<ActiveForm v-if="item.incomeType==='10'" required>
					<view class="active_label">
						经营地址：
					</view>
					<view class="active_input">
						<input  type="text" v-model="item.companyAddress" />
					</view>
				</ActiveForm>
				<ActiveForm v-if="item.incomeType==='10'" required>
					<view class="active_label">
						法定代表人：
					</view>
					<view class="active_input">
						<input  type="text" v-model.trim="item.legalPerson" />
					</view>
				</ActiveForm>
				<ActiveForm v-if="item.incomeType==='10'" required>
					<view class="active_label">
						经营年限：
					</view>
					<view class="active_input">
						<input  type="text" v-model="item.operatingYears" />
					</view>
				</ActiveForm>
				
				<ActiveForm v-if="item.incomeType==='10'" required>
					<view class="active_label">
						主营业务：
					</view>
					<view class="active_input">
						<input  type="text" v-model="item.mainBusiness" />
					</view>
				</ActiveForm>
				<ActiveForm v-if="item.incomeType==='10'" required>
					<view class="active_label">
						占股比例：
					</view>
					<view class="active_input">
						<input  type="text" v-model="item.shareProportion" />
					</view>
				</ActiveForm>
				<ActiveForm required>
					<view class="active_label">
						总资产金额（元）：
					</view>
					<view class="active_input">
						<mInput maxlength="16" v-model="item.assetsAmount" />
					</view>
				</ActiveForm>
				
				<ActiveForm required>
					<view class="active_label">
						总负债金额（元）：
					</view>
					<view class="active_input">
						<mInput maxlength="16" v-model="item.debtAmount" />
					</view>
				</ActiveForm>
				
				<ActiveForm>
					<view class="active_label">
						婚姻状况：
					</view>
					<view class="active_input">
						<SelectPicker :disabled='!!item.uuid' v-model="item.marStatus" :options="marStatusOption" placeholder="请选择" />
					</view>
				</ActiveForm>
				
				<ActiveForm v-if="item.marStatus==='20'">
					<view class="active_label">
						配偶姓名：
					</view>
					<view class="active_input">
						<input :disabled='!!item.uuid' type="text" v-model.trim="item.maritalName" />
					</view>
				</ActiveForm>
				<ActiveForm  v-if="item.marStatus==='20'">
					<view class="active_label">
						配偶单位：
					</view>
					<view class="active_input">
						<input :disabled='!!item.uuid' type="text" v-model="item.maritalOrg" />
					</view>
				</ActiveForm>
				<ActiveForm  v-if="item.marStatus==='20'">
					<view class="active_label">
						配偶电话：
					</view>
					<view class="active_input">
						<input :disabled='!!item.uuid' type="number" maxlength="11" v-model.trim="item.maritalTelephone" />
					</view>
				</ActiveForm>

				
				

				
			</view>
			<view class="btn" > 
				<button v-if="!item.uuid"  type="primary" size="mini" @click="save(item)">保存</button>
				<block v-else>
					<button type="default" size="mini" @click="qcode(item.auth)">担保主体授权</button>
					<button type="primary" :disabled="item.auth.isAuth=='未授权'" size="mini" @click="look(item.auth)">查看征信报告</button>
					<button v-if="item.subjectType=='2'" type="primary" :disabled="item.auth.authedTax=='未授权'" size="mini" @click="look2(item.auth)">查看税务数据</button>
					<button type="primary" size="mini" @click="refresh(item)">刷新</button>
				</block>
				
			</view>
			
			<!-- 新增房产，车产 -->
			<view class="active_tit">
				<view class="tit">
					资产情况（房产类/土地类）
				</view>
			</view>
			<block v-for="(zitem,zindex) in item.stdOffsurCollateral" >
				<view class="cut">房产{{zindex+1}} 【为避免楼栋号，房号输入不准确，请点击【精准选择】按钮选择确认。】 <uni-icons class="clear" type="clear" @click='stdDel(item.stdOffsurCollateral,zitem,"stdOffsurSceneLoanRelation")'></uni-icons>
				</view>
			
				<ActiveForm required ref=''>
					<view class="active_label">
						房产性质：
					</view>
					<view class="active_input">
						<SelectPicker v-model="zitem.buildingAttr" :options="buildingAttrOption" placeholder="请选择" />
					</view>
				</ActiveForm>
				
				<ActiveForm required ref='mortgageAdd'>
					<view class="active_label">
						资产所在地区：
					</view>
					<view class="active_input">
						<RegionPicker :value="mortgageAdd(zitem.mortgageAdd)" :options="region2" @change="((o)=>{zitem.mortgageAdd=o.value.toString()})" />
					</view>
				</ActiveForm>
			
				<ActiveForm required ref='buildingName'>
					<view class="active_label">
						楼盘名称：
					</view>
					<view class="active_input">
						<input type="text" v-model="zitem.buildingName" placeholder="关键字查询" />
						<button type="pg" @click="selectXx(zindex,'buildingName',0,zitem,index)">楼盘查询</button>
					</view>
				</ActiveForm>
				<ActiveForm required ref='buildingNo'>
					<view class="active_label">
						楼栋号（号数）：
					</view>
					<view class="active_input">
						<input type="text" :disabled='zcDisabled' v-model="zitem.buildingNo" />
						<button type="pg" @click="selectXx(zindex,'buildingNo',1,zitem,index)">精准选择</button>
					</view>
				</ActiveForm>
				<ActiveForm required ref='floor'>
					<view class="active_label">
						所在楼层（层数）：
					</view>
					<view class="active_input">
						<input @input="fcInout(zitem)" type="number" v-model="zitem.floor" />
			
					</view>
				</ActiveForm>
				<ActiveForm required ref='floor'>
					<view class="active_label">
						房号（号数）：
					</view>
					<view class="active_input">
						<input :disabled='zcDisabled' type="text" v-model="zitem.roomNo" />
						<button type="pg" @click="selectXx(zindex,'roomNo',2,zitem,index)">精准选择</button>
					</view>
				</ActiveForm>
				<ActiveForm required ref='allFloor'>
					<view class="active_label">
						总层数（层数）：
					</view>
					<view class="active_input">
						<mInput :thousand='false' type="number" v-model="zitem.allFloor" />
					</view>
				</ActiveForm>
				<ActiveForm required ref='area'>
					<view class="active_label">
						面积（平方米）：
					</view>
					<view class="active_input">
						<mInput @input="fcInout(zitem)" :thousand='false' type="number" v-model="zitem.area" />
					</view>
				</ActiveForm>
				<ActiveForm required ref='guaranteeBalance'>
					<view class="active_label">
						贷款余额（元）：
					</view>
					<view class="active_input">
						<mInput placeholder='此套房产的所有抵押贷款' maxlength="16" type="number" v-model="zitem.guaranteeBalance" />
					</view>
				</ActiveForm>
				<ActiveForm required ref='autoAssessPrice'>
					<view class="active_label">
						评估价值（线上）：
					</view>
					<view class="active_input">
						<mInput type="number" :disabled="true" v-model="zitem.autoAssessPrice" />
						<button type="pg" @click="pg(zitem,index)">线上评估</button>
					</view>
				</ActiveForm>
				<ActiveForm required ref='manAssessPrice'>
					<view class="active_label">
						评估价值（人工）：
					</view>
					<view class="active_input">
						<mInput maxlength="16" type="number" v-model="zitem.manAssessPrice" />
					</view>
				</ActiveForm>
				<ActiveForm required ref='residue'>
					<view class="active_label">
						剩余价值（元）：
					</view>
					<view class="active_input">
						<mInput type="number" :disabled="true" :value="sy(zitem)" />
					</view>
				</ActiveForm>
				<ActiveForm required ref='residue'>
					<view class="active_label">
						备注：
					</view>
					<view class="active_input">
						<input type="text"  v-model="zitem.remark" />
					</view>
				</ActiveForm>
				<block v-for="(qitem,qindex) in zitem.obligeeNameList" >
					<view class="cut">权利人{{qindex+1}}
						<uni-icons class="clear" type="clear" @click='stdDel(zitem.obligeeNameList,qitem,"stdOffsurSceneLoanRelation")'></uni-icons>
					</view>
				
					<ActiveForm required ref=''>
						<view class="active_label">
							权利人名称：
						</view>
						<view class="active_input">
							<input type="text" v-model="qitem.pledgorName" />
						</view>
					</ActiveForm>
				
				</block>
				<view class="active_tit">
					<view class="tit">
					</view>
					<view class="add" @click="addUser(zitem)">
						添加权利人
					</view>
				</view>
			</block>
			
			<view class="active_tit">
				<view class="" style="display: flex;">
					<view class="add" @click="addCol(item)">
						添加资产
					</view>
			
				</view>
			</view>
			
			<!-- 汽车 -->
			<view class="active_tit">
				<view class="tit">
					资产情况（汽车）
				</view> 
			</view>
			<!-- input -->
			<view v-for="(citem,index) in item.stdOffsurCars" >
				<view class="cut">家用车{{index+1}} <uni-icons class="clear" type="clear" @click='stdDel(item.stdOffsurCars,citem,"stdOffsurSceneLoanRelation")'></uni-icons></view>
				<view class="main">
					<ActiveForm required  ref=''>
						<view class="active_label">
							序号：
						</view>
						<view class="active_input">
							<input type="text" :disabled="true" v-model="citem.xh" />
						</view>
					</ActiveForm>
					<ActiveForm required  ref=''>
						<view class="active_label">
							所有权人：
						</view>
						<view class="active_input">
							<input type="text" v-model.trim="citem.asssetsOwner" />
						</view>
					</ActiveForm>
					<ActiveForm required  ref=''>
						<view class="active_label">
							品牌型号：
						</view>
						<view class="active_input">
							<input type="text" v-model="citem.brandType" />
						</view>
					</ActiveForm>
					<ActiveForm required  ref=''>
						<view class="active_label">
							购买时间：
						</view>
						<view class="active_input">
							<!-- <input type="text" v-model="item.buyTime" /> -->
							<picker style="width: 100%;" mode="date" :value="citem.buyTime"   @change="(o)=>{citem.buyTime=o.target.value}">
							    <view >{{citem.buyTime}}</view>
							</picker>
						</view>
					</ActiveForm>
					<ActiveForm required  ref=''>
						<view class="active_label">
							购买价格（元）：
						</view>
						<view class="active_input">
							<mInput maxlength="16" type="number" v-model="citem.price" />
						</view>
					</ActiveForm>
					<!-- <ActiveForm required  ref=''>
						<view class="active_label">
							贷款余额（元）：
						</view>
						<view class="active_input">
							<mInput maxlength="16" type="number" v-model="citem.guarBalance" />
						</view>
					</ActiveForm> -->
					<ActiveForm required   ref=''>
						<view class="active_label">
							车牌号：
						</view>
						<view class="active_input">
							<input type="text" v-model="citem.carCode" />
						</view>
					</ActiveForm>
					<ActiveForm   ref=''>
						<view class="active_label">
							备注：
						</view>
						<view class="active_input">
							<input type="text" v-model="citem.remark" />
						</view>
					</ActiveForm>
				</view>
			</view>
			<view class="active_tit">
				<view class="" style="display: flex;">
					<view class="add" @click="addCar(item)">
						新增家用车
					</view>
				</view>
			</view>
			<ActiveForm required  ref=''>
				<view class="active_label">
					购买价格总计：
				</view>
				<view class="active_input">
					<input type="number"  :disabled="true" v-model="item.goumaizongjia" />
				</view>
			</ActiveForm>
			<view class="main" v-if="item.subjectType=='2'">
				<view class="active_tit">
					<view class="tit">
						企业财务情况
					</view> 
				</view>
			    <ActiveForm>
					<view class="active_label">
						总资产金额（元）：
					</view>
					<view class="active_input">
						<mInput maxlength="16" type="number" v-model="item.assetsAmount" />
					</view>
				</ActiveForm>
			
				<ActiveForm>
					<view class="active_label">
						总负债金额（元）：
					</view>
					<view class="active_input">
						<mInput maxlength="16" type="number" v-model="item.debtAmount" />
					</view>
				</ActiveForm>
				<ActiveForm>
					<view class="active_label">
						净资产（元）：
					</view>
					<view class="active_input">
						<mInput disabled maxlength="16" type="number" :value="jzc(item)" />
					</view>
				</ActiveForm>
				<ActiveForm>
					<view class="active_label">
						资产负债率：
					</view>
					<view class="active_input">
						<mInput disabled maxlength="16" type="number" :value="fzl(item)" />
					</view>
				</ActiveForm>
				<ActiveForm>
					<view class="active_label">
						本年营业收入（元）：
					</view>
					<view class="active_input">
						<mInput maxlength="16" type="number" v-model="item.companyIncomeYear" />
					</view>
				</ActiveForm>
				<ActiveForm>
					<view class="active_label">
						其他年收入（元）：
					</view>
					<view class="active_input">
						<mInput maxlength="16" type="number" v-model="item.otherIncomeYear" />
					</view>
				</ActiveForm>
				<ActiveForm>
					<view class="active_label">
						本年营业利润（元）：
					</view>
					<view class="active_input">
						<mInput maxlength="16" type="number" v-model="item.operatingProfitYear" />
					</view>
				</ActiveForm>
				<ActiveForm>
					<view class="active_label">
						本年营业净利润（元）：
					</view>
					<view class="active_input">
						<mInput maxlength="16" type="number" v-model="item.netOperatingProfitYear" />
					</view>
				</ActiveForm>
				<ActiveForm>
					<view class="active_label">
						备注：
					</view>
					<view class="active_input">
						<input  v-model="item.remark" />
					</view>
				</ActiveForm>
			
			</view>
			
			<!-- 企业应收装款明细 -->
			<block v-if="item.subjectType=='2'">
				<view class="active_tit">
					<view class="tit">
						企业应收账款明细
					</view> 
				</view>
				
				<view v-for="(ditem,index) in item.stdOffsurSlrReceiveAccount" >
					<view class="cut">应收账款明细{{index+1}} <uni-icons class="clear" type="clear" @click='stdDel(item.stdOffsurSlrReceiveAccount,ditem,"stdOffsurSceneLoanRelation")'></uni-icons></view>
					<view class="main">
						<ActiveForm required  ref=''>
							<view class="active_label">
								序号：
							</view>
							<view class="active_input">
								<input type="text" :disabled="true" v-model="ditem.xh" />
							</view>
						</ActiveForm>
						<ActiveForm required  ref=''>
							<view class="active_label">
								债务人：
							</view>
							<view class="active_input">
								<input type="text" v-model.trim="ditem.debtUsername" />
							</view>
						</ActiveForm>
						
						<ActiveForm required  ref=''>
							<view class="active_label">
								发生日期：
							</view>
							<view class="active_input">
								<!-- <input type="text" v-model="item.buyTime" /> -->
								<picker style="width: 100%;" mode="date" :value="ditem.occurTime"   @change="(o)=>{ditem.occurTime=o.target.value}">
								    <view >{{ditem.occurTime}}</view>
								</picker>
							</view>
						</ActiveForm>
						<ActiveForm required  ref=''>
							<view class="active_label">
								账龄（月）：
							</view>
							<view class="active_input">
								<input type="text" v-model="ditem.accountAge" />
							</view>
						</ActiveForm>
						<ActiveForm required  ref=''>
							<view class="active_label">
								预计回收时间：
							</view>
							<view class="active_input">
								<!-- <input type="text" v-model="item.buyTime" /> -->
								<picker style="width: 100%;" mode="date" :value="ditem.receiveTimePlan"   @change="(o)=>{ditem.receiveTimePlan=o.target.value}">
								    <view >{{ditem.receiveTimePlan}}</view>
								</picker>
							</view>
						</ActiveForm>
						<ActiveForm required  ref=''>
							<view class="active_label">
								金额（元）：
							</view>
							<view class="active_input">
								<mInput maxlength="16" type="number" v-model="ditem.receiveAtm" />
							</view>
						</ActiveForm>
						
						<ActiveForm   ref=''>
							<view class="active_label">
								结算方式：
							</view>
							<view class="active_input">
								<input type="text" v-model="ditem.settlementType" />
							</view>
						</ActiveForm>
					</view>
				</view>
				<view class="active_tit">
					<view class="" style="display: flex;">
						<view class="add" @click="addAcc(item)">
							新增应收账款
						</view>
					</view>
				</view>
				
			</block>
			
			<!-- <ActiveForm ref='' style="width: 100% !important;" v-if="item.subjectType=='2'">
				<radio-group @change="selectAuth($event,item)">
					<text style="font-size: 3rem;">是否进行税务授权：</text>
					<label class="radio" style="font-size: 3rem;">
						<radio value="1" :checked="item.isTaxAuthorization==1" />是
					</label>
					<label class="radio" style="margin-left: 2rem;font-size: 3rem;">
						<radio value="2" :checked="item.isTaxAuthorization==2" />否
					</label>
				</radio-group>
				
			</ActiveForm> -->
			
			
			
		</block>
		<view class="active_tit">
			<view class="" style="display: flex;">
				<view class="add" @click="add">
					添加自然人担保人
				</view>
				<view class="add" @click="add2">
					添加企业担保人
				</view>
			</view>
		</view>
		
		<!-- 20220808  新增 高保合同引入 -->
		<view style="padding-left: 3rem;width: 100%;" v-if="loanType!=='4'">

			<ActiveForm ref='maxGuaContract' style="width: 100% !important;">
				<radio-group @change="selectMaxGuaContract">
					<text style="font-size: 3rem;">是否引入最高额保证合同：</text>
					<label class="radio" style="font-size: 3rem;">
						<radio value="Y" :checked="maxGuaContract=='Y'" />是
					</label>
					<label class="radio" style="margin-left: 2rem;font-size: 3rem;">
						<radio value="N" :checked="maxGuaContract=='N'" />否
					</label>
				</radio-group>
			</ActiveForm>
		</view>

		<!-- 最高保证合同展示 -->
		<block v-if="maxGuaContract=='Y'">
			<ActiveForm ref=''>
				<view class="active_label" style="width: 50rem;">
					最高额保证合同编号：
				</view>
				<view class="active_input">
					<input type="text" v-model="contractId" placeholder="合同编号" />
					<button type="pg" @click="getContract()">引入</button>
				</view>
			</ActiveForm>
			<!--  -->
			<block v-for="(item,index) in stdOffsurGnrContract" :key="index+400">
				<view class="cut">最高额保证合同{{index+1}}
					<uni-icons class="clear" type="clear"
						@click='stdDel(stdOffsurGnrContract,item,"stdOffsurGnrContract")'>
					</uni-icons>
				</view>

				<ActiveForm ref=''>
					<view class="active_label">
						最高额保证合同编号：
					</view>
					<view class="active_input">
						<input disabled type="text" v-model="item.contractId" />
					</view>
				</ActiveForm>

				<ActiveForm>
					<view class="active_label">
						借款人名称：
					</view>
					<view class="active_input">
						<input disabled type="text" v-model.trim="item.applName" />
					</view>
				</ActiveForm>


				<ActiveForm ref='manAssessPrice'>
					<view class="active_label">
						最高额担保金额（元）：
					</view>
					<view class="active_input">
						<mInput disabled maxlength="16" type="number" v-model="item.maxGurtAmt" />
					</view>
				</ActiveForm>

				<ActiveForm>
					<view class="active_label">
						保证人：
					</view>
					<view class="active_input">
						<input disabled type="text" v-model.trim="item.gnrNames" />
					</view>
				</ActiveForm>
				<ActiveForm required ref='residue'>
					<view class="active_label">
						拟申请占用金额（元）：
					</view>
					<view class="active_input">
						<mInput placeholder="请输入" @blur='atmblur($event,item)' type="number"
							v-model="item.applOccupyAmt" />
					</view>
				</ActiveForm>
				<ActiveForm ref='residue'>
					<view class="active_label">
						可用担保金额（元）：
					</view>
					<view class="active_input">
						<mInput disabled type="number" v-model="item.avaiGurtAmt" />
					</view>
				</ActiveForm>
				<!-- <ActiveForm  ref=''>
					<view class="active_label">
						保证合同期限：
					</view>
					<view class="active_input">
						<input disabled type="text" v-model="item.gnRPeriod" />
					</view>
				</ActiveForm> -->
				<ActiveForm ref=''>
					<view class="active_label">
						担保起始日：
					</view>
					<view class="active_input">
						<input disabled type="text" v-model="item.statDt" />
					</view>
				</ActiveForm>
				<ActiveForm ref=''>
					<view class="active_label">
						担保到期日：
					</view>
					<view class="active_input">
						<input disabled type="text" v-model="item.endDt" />
					</view>
				</ActiveForm>
				<ActiveForm ref=''>
					<view class="active_label">
						合同状态：
					</view>
					<view class="active_input">
						<input disabled type="text" value="生效" />
					</view>
				</ActiveForm>
			</block>
		</block>		
		
		
		
		
		
		
		
		
		

		<!-- 弹框 -->
		<uni-popup ref="popup" type="dialog" style="width: 70rem;height: 45rem;">
			<uni-popup-dialog @confirm='pclick' title="授权二维码" :showCancel="false" type="info" :duration="2000"
				style="width: 100%;height: 100%;">
				<view class="qcode">
					<text style="font-size: 2.8rem;">请使用手机自带浏览器扫描</text>
					<view class="qcodeCont" >
						<!-- 非企业不展示税务授权二维码 -->
						<view class="cont" v-if="tobeAuthType!=='3'">
							<view style="font-size: 2.8rem;padding-bottom: 2rem;">征信/综合数据查询授权</view>
							<tki-qrcode :size='400' cid="qrcode" ref="qrcode" :val="val" :showLoading="true" style="width: 50%;height: 100%;margin:0 auto;padding:2rem 0" />
							<view style="font-size: 2.8rem;padding-top: 2rem;">征信/综合数据查询授权：
							<text v-if="isAuth==='已授权'" style="color: blue;font-weight: bold;">{{isAuth}}</text>
							<text v-else style="color: red;font-weight: bold;">{{isAuth}}</text>
							</view>
						</view>
						<!-- <view class="cont" v-if="tobeAuthType==='3'">
							<view style="font-size: 2.8rem;padding-bottom: 2rem;">第一步：征信/综合数据查询授权</view>
							<tki-qrcode :size='400' cid="qrcode" ref="qrcode" :val="val" :showLoading="true" style="width: 100%;height: 100%;" />
						    <view style="font-size: 2.8rem;padding-top: 2rem;">征信/综合数据查询授权：
							<text v-if="isAuth==='已授权'" style="color: blue;font-weight: bold;">{{isAuth}}</text>
							<text v-else style="color: red;font-weight: bold;">{{isAuth}}</text>
							</view>
						</view> -->
						<view class="cont" v-show="tobeAuthType==='3'" >
							<view style="font-size: 2.8rem;padding-bottom: 2rem;">税务数据查询授权</view>
							<tki-qrcode :size='400' cid="qrcode2" ref="qrcode2" :val="val2" :showLoading="true" style="width: 50%;height: 100%;margin:0 auto" />
						    <view style="font-size: 2.8rem;padding-top: 2rem;">税务数据查询授权：
							<text v-if="authedTax==='已授权'" style="color: blue;font-weight: bold;">{{authedTax}}</text>
							<text v-else style="color: red;font-weight: bold;">{{authedTax}}</text>
						    </view>
						</view>
					</view>
					
				</view>
			</uni-popup-dialog>
		</uni-popup>	
		
		<uni-popup ref="popups" type="dialog" style="width: 70rem;height: 40rem;">
			<uni-popup-dialog @confirm='zxbgcon' title="征信报告" type="info" :duration="2000"
				style="width: 100%;height: 100%;">
				<scroll-view scroll-y="true" style="height: 70rem;">
					<view class="zx" v-append="zxbg" @appended="appended"></view>
				</scroll-view>
			</uni-popup-dialog>
		</uni-popup>
		<uni-popup ref="popup3" type="dialog" style="width: 40rem;height: 40rem;">
			<uni-popup-dialog @confirm='zxbgcon2' title="税务数据" type="info" :duration="2000"
				style="width: 100%;height: 100%;">
				<scroll-view scroll-y="true" style="height: 70rem;">
					<n-table :tableHeight="200" ref="table1" :nameOpt="{title:'纳税人基本信息'}" colKey='prop' :columns='col' :tableData='tableData'></n-table>
					<n-table ref="table3" :nameOpt="{title:'查询企业增值税申报行为'}" colKey='prop' :columns='col3' :tableData='tableData3'></n-table>
					<n-table ref="table2" :nameOpt="{title:'查询企业所得税申报行为'}" colKey='prop' :columns='col2' :tableData='tableData2'></n-table>
					
				</scroll-view>
			</uni-popup-dialog>
		</uni-popup>
		
		<!-- 证件OCR -->
		<uni-popup ref="imgPopups" type="dialog" style="width: 70rem;height: 40rem;">
			<uni-popup-dialog @confirm='ocrImg2' :before-close="true" @close="ocrClose" title="选择影像" type="info" :duration="2000"
				style="width: 100%;height: 100%;">
				<view style="width: 100rem;height:50rem;display:flex;">
					<view style="display:flex;justify-content: center;flex-direction: column;align-items: center;">
						<button  @click="chooseImg2('1')" size="mini" type="primary">选择身份证正面</button>
						<image style='width: 50rem;height: 25rem;' :src="ocrImgUrl1" mode=""></image>
					</view>
					<view style="display:flex;justify-content: center;flex-direction: column;align-items: center;">
						<button  @click="chooseImg2('2')" size="mini" type="primary">选择身份证反面</button>
					    <image style='width: 50rem;height: 25rem;' :src="ocrImgUrl2" mode=""></image>
					</view>
				</view>
			</uni-popup-dialog>
		</uni-popup>
	</view>
</template>

<script>
	import chooseImgToBase64 from "@/utils/chooseImgToBase64";
	import tkiQrcode from "@/components/tki-qrcode/tki-qrcode.vue"
	import uniPopupDialog from "@/components/uni-popup-dialog/uni-popup-dialog.vue";
	import SelectPicker from "../../SelectPicker";
	import RegionPicker from "../../RegionPicker";
	import region from '../areaList.js'
	export default {
		name: 'activeForm',
		data() {
			return {
				ocrImgUrl1:'',
				ocrImgUrl2:'',
				ocrImgData1:'',
				ocrImgData2:'',
				ocrTypes:'',
				ocrItem:{},
				loanType:'',
				// ====0808=================
				contractId: '', //合同编号
				stdOffsurGnrContract: [],
				maxGuaContract: '',
				// ==================
				maritalIdTypeOptions:[],
				authedTax:'未授权',
				isAuth:'未授权',
				tobeAuthType:'',
				zcDisabled: true,
				isdisabled:false,
				region2:[],
				buildingAttrOption:[],
				pledgorTypeOption:[],
				selectIndex:'',
				selectName:'', 
				selectNode:'', 
				props0: {
					label: 'projectName',
					value: 'projectId'
				},
				props: {
					label: 'buildingName',
					value: 'buildingName'
				},
				props2: {
					label: 'houseName',
					value: 'houseName'
				},
				list: [],
				list0: [],
				list2: [],
				tableData:[],
				col:[],
				tableData2:[],
				col2:[],
				tableData3:[],
				col3:[],
				val: '',
				val2: '',
				zxbg: '',
				guaranteeType: null,
				businessType: '1',
				appluserType: '',
				region,
				province: "",
				city: "",
				county: "",
				index: 1,
				entOptions: [],
				form: {
					corCerttype: '',
					checked: '',
					arr: [{
						name: ''
					}, ]
				},
				stdOffsurSceneLoanRelation: [],
				subjectTypeOption: [],
				ideyAttributeOption: [],
				ideyAttributeOption2: [],
				marStatusOption: [],
				relationshipOption: [],
				corCerttypeOptions: [{
						label: "营业执照",
						value: "1",
					},
					{
						label: "个体工商户",
						value: "2",
					},
				],
				incomeTypeArr:[
					{
						label: "经营型",
						value: "10",
					},
					{
						label: "非经营型",
						value: "20",
					},
				]
			}
		},
		props: {
			changeFlag: {
				type: String
			},
		},
		components: {
			SelectPicker,
			RegionPicker
		},
		computed: {
			jzc(){
				return function(item) {	
					item.netAssets = Number(item.assetsAmount)  - Number(item.debtAmount)
					if(item.netAssets<0){
						return 0
					}else{
						if(isNaN(item.netAssets) ){
							return 0
						}else{
							return item.netAssets
						}	
					}
				}
				
			},
			fzl(){
				return function(item) {
					if(!item.assetsAmount||!item.debtAmount){
						return 0
					}else{
						item.assetsLiabilityRatio = (Number(item.debtAmount)/ Number(item.assetsAmount)).toFixed(4)
					    return item.assetsLiabilityRatio
					}
					
				}
				
			},
			sy() {
				return function(item) {
					if(this.loanType==='4'){
						item.residue = item.manAssessPrice - item.guaranteeBalance	
					}else{
						item.residue = item.autoAssessPrice != '' && item.autoAssessPrice != '0' ? item.autoAssessPrice - item.guaranteeBalance :
							Number(item.manAssessPrice)  - Number(item.guaranteeBalance)
					}
					
					if(item.residue<0){
						return 0
					}else{
						if(isNaN(item.residue) ){
							return 0
						}else{
							return item.residue
						}
						
					}
				}
			},
			mortgageAdd() {
				return function(val) {
					if (val == '' || val == null) {
						return []
					} else {
						let arr = val.split(",")
						return arr
					}
				}
			},
		
			address() {
				return function(val) {
					//debugger
					if (val == '' || val == null) {
						return []
					} else {
						let arr = val.split(",")
						return arr
					}
				}
			}
		},
		watch: {
			stdOffsurGnrContract: {
				handler: function(res) {
					console.log(res)
					getApp().globalData.stdOffsurGnrContract = res
				},
				deep: true
			},			
			changeFlag: {
				
				handler: function(res) {
					//console.log(res)
					//获取关联企业
					this.entOptions = getApp().globalData.stdOffsurEntRelation
					this.entOptions.map((item) => {
						item.label = item.entName
						item.value = item.entName
					})

				},
				deep: true
			},
			stdOffsurSceneLoanRelation: {
				handler: function(res) {
					//console.warn('stdOffsurSceneLoanRelation组件数据变化',res)
					getApp().globalData.stdOffsurSceneLoanRelation = res
					for(let i=0;i<res.length;i++){
						if(this.stdOffsurSceneLoanRelation[i].stdOffsurCars&&this.stdOffsurSceneLoanRelation[i].stdOffsurCars.length>0){
							this.stdOffsurSceneLoanRelation[i].zongjia =  this.stdOffsurSceneLoanRelation[i].stdOffsurCars.reduce((totalPrice, item) => totalPrice + Number(item.guarBalance), 0)
							 this.stdOffsurSceneLoanRelation[i].goumaizongjia =  this.stdOffsurSceneLoanRelation[i].stdOffsurCars.reduce((totalPrice, item) => totalPrice + Number(item.price), 0)	
						}
						 
					}
				},
				deep: true
			}
		},
		mounted() {
			//获取返显数据
			setTimeout(() => {
				this.region2 = getApp().globalData.FxtData
				this.buildingAttrOption = getApp().globalData.optType.BUL_ATT
				
				this.loanType = getApp().globalData.stdOffsurBaiscInfo.loanType

				//数据反显
				this.stdOffsurSceneLoanRelation = getApp().globalData.stdOffsurSceneLoanRelation
				this.stdOffsurSceneLoanRelation.map((item) => {
					if (item.assEntFlag == "true") {
						item.assEntFlag = true
					} else {
						item.assEntFlag = false
					}
				})
				this.maritalIdTypeOptions = getApp().globalData.optType.IDENT
				this.subjectTypeOption = getApp().globalData.optType.SUBJECT
				this.ideyAttributeOption = getApp().globalData.optType.IDEN_ATT_GR //自然人
				this.ideyAttributeOption2 = getApp().globalData.optType.IDEN_ATT_QY //企业
				this.marStatusOption = getApp().globalData.optType.MARITAL
				this.relationshipOption = getApp().globalData.optType.REL

				this.businessType = getApp().globalData.stdOffsurBaiscInfo.businessType
				this.appluserType = getApp().globalData.stdOffsurBaiscInfo.appluserType


				this.guaranteeType = getApp().globalData.stdOffsurBaiscInfo.guaranteeType
				
				// 0808
				this.stdOffsurGnrContract = getApp().globalData.stdOffsurGnrContract || []
				this.maxGuaContract = getApp().globalData.stdOffsurBaiscInfo.maxGuaContract 

			}, getApp().globalData.timeout)
		},
		methods: {
			fcInout(item){
				item.autoAssessPrice = 0
			},
			addCol(item){//新增资产
			  item.stdOffsurCollateral.push({mortagageCount: '',roomNo:'',autoAssessPrice:'',obligeeNameList:[{}]})
			},
			confirm0(e) {
				console.log(e)
				this.stdOffsurSceneLoanRelation[this.selectNode].stdOffsurCollateral[this.selectIndex][this.selectName]= e.item.projectName
				this.stdOffsurSceneLoanRelation[this.selectNode].stdOffsurCollateral[this.selectIndex].projectId = e.item.projectId
			},
			confirm(e) {
				this.stdOffsurSceneLoanRelation[this.selectNode].stdOffsurCollateral[this.selectIndex].projectId = this.list[e.index].projectId
				this.stdOffsurSceneLoanRelation[this.selectNode].stdOffsurCollateral[this.selectIndex].buildingId = this.list[e.index].buildingId
				this.stdOffsurSceneLoanRelation[this.selectNode].stdOffsurCollateral[this.selectIndex][this.selectName] = e.value
			},
			confirm2(e) {
				this.stdOffsurSceneLoanRelation[this.selectNode].stdOffsurCollateral[this.selectIndex].houseId = this.list2[e.index].houseId
				this.stdOffsurSceneLoanRelation[this.selectNode].stdOffsurCollateral[this.selectIndex][this.selectName] = e.value
			},
			addUser(item){
				item.obligeeNameList.push({})
			},
			addCar(item){
				let obj = {
					xh:item.stdOffsurCars.length + 1,
					guarBalance:'',
					price:'',
					buyTime:''
				}
				item.stdOffsurCars.push(obj)
			},
			addAcc(item){
				let obj = {
					xh:item.stdOffsurSlrReceiveAccount.length + 1,
					occurTime:''
				}
				item.stdOffsurSlrReceiveAccount.push(obj)
				
			},
			//=====新增ocr============
			openOcr(item){
				this.ocrItem = item
				this.$refs.imgPopups.open()
			},
			chooseImg2(type){
				chooseImgToBase64(
					(base64, base64SourceData, file) => {
						this.ocrTypes = file.type.split('/')
						if(type==='1'){
							this.ocrImgUrl1 = base64
							this.ocrImgData1 = base64SourceData
						}else{
							this.ocrImgUrl2 = base64
							this.ocrImgData2 = base64SourceData
						}
						
					}, 500
							
				);
				
			},
			chooseImg(item) {
			
				chooseImgToBase64(
					(base64, base64SourceData, file) => {
						this.ocrImg(item,base64SourceData,file)
					}, 500
			
				);
			},
			ocrImg(item,base64){
				this.sendRequest({
					url: 'businessLicense/businessLicenseRec',
					method: 'post',
					hideLoading: false,
					data: {
						"imageFile": base64,
					},
					complete: (res) => {
						if (res.code == '200'&&res.data.result==='0') {
							let cont = res.data.ocrResult
							for(let i=0;i<cont.length;i++){
								if(cont[i].fieldName==='统一社会信用代码'){
									item.idCode = cont[i].fieldValue	
								}else if(cont[i].fieldName==='名称'){
									item.relName = cont[i].fieldValue	
								}else if(cont[i].fieldName==='法定代表人'){
									item.legalPerson = cont[i].fieldValue	
								}
							}
						} else {
							uni.showToast({
								icon: "none",
								title: 'OCR识别失败，请重试',
								duration: 2000
							})
						}
					}
				})
				
			},
			ocrClose(){
				this.ocrImgUrl1 = ''
				this.ocrImgUrl2 = ''
				this.ocrImgData1=''
				this.ocrImgData2=''
				this.$refs.imgPopups.close()
				
			},
			ocrImg2(){
				if(!this.ocrImgData2||!this.ocrImgData1){
					uni.showToast({
						icon: "none",
						title: '请上传完整证件正反面影像',
						duration: 2000
					})
					return false
				}
				
				this.sendRequest({
					url: 'ocr/ocrIdCard',
					method: 'post',
					hideLoading: false,
					data: {
						"backImg": this.ocrImgData2,
						"backImgSuffix":this.ocrTypes[1],	
						"frontImg": this.ocrImgData1,
						"frontImgSuffix":this.ocrTypes[1],
						"reqId": getApp().globalData.stdOffsurBaiscInfo.reqId,
						"businessId": getApp().globalData.stdOffsurBaiscInfo.businessId,
					},
					complete: (res) => {
						if (res.code == '200') {
							this.ocrItem.relName = res.data.ucName
							this.ocrItem.idCode = res.data.ucNumber
							this.ocrItem.startDate = res.data.dateStart
							this.ocrItem.endDate = res.data.dateEnd
							this.ocrClose()
						} else {
							uni.showToast({
								icon: "none",
								title: 'OCR识别失败，请重试',
								duration: 2000
							})
						}
					}
				})
				
			},
			//==================
			zxbgcon() {
				this.$refs.popups.close()
			},
			zxbgcon2() {
				this.$refs.popup3.close()
			},
			selectAuth(e,item) {
				item.isTaxAuthorization = e.detail.value
			},
			selectGuaranteeType(e) {
				console.log(e)
				this.guaranteeType = e.detail.value
				getApp().globalData.stdOffsurBaiscInfo.guaranteeType = e.detail.value
			},
			userBlur(item) {
				console.log(item.subjectType)
				if (item.subjectType == '2') {
					if (item.relName == getApp().globalData.stdOffsurEntBasic.entName) {
						item.relName = ''
						uni.showToast({
							icon: 'none',
							title: '担保主体不能为经营主体自身！',
							duration: 2500
						});

						return false
					}
					//relName
				} else {
					if (item.relName == getApp().globalData.stdOffsurIndBasic.custName) {
						item.relName = ''
						uni.showToast({
							icon: 'none',
							title: '担保主体不能为申请人自身！',
							duration: 2500
						});

						return false
					}
				}
			},
			entBlur(item) {
				if (item.idCode == getApp().globalData.stdOffsurEntBasic.creditCode) {
					item.idCode = ''
					uni.showToast({
						icon: 'none',
						title: '担保主体不能为经营主体自身！',
						duration: 2500
					});

					return false
				}
			},
			onBlur(item, name) {
				if (!this.checkIDCard(item[name])) {
					item[name] = ''
					uni.showToast({
						icon: 'none',
						title: '身份证号码无效,请重新输入！',
						duration: 2500
					});
				}
				if (item.subjectType == '2') {

					//relName
				} else {
					if (item[name] == getApp().globalData.stdOffsurIndBasic.idCode) {
						item[name] = ''
						uni.showToast({
							icon: 'none',
							title: '担保主体不能为申请人自身！',
							duration: 2500
						});

						return false
					}
				}


			},
			change1(e, index) {},
			select(e, index) {
				//console.log(e,index)
				if (getApp().globalData.stdOffsurBaiscInfo.appluserType == 3 || getApp().globalData.stdOffsurBaiscInfo
					.appluserType ==
					4) {
					if (e == '01') {
						uni.showToast({
							icon: "none",
							title: "【法人，个体工商户】申请，无法选择法定代表人",
							duration: 2000
						})
						setTimeout(() => {
							this.stdOffsurSceneLoanRelation[index].ideyAttribute = null
						}, 50)
					}

				}
				if (e == '01' || e == '03' || e == '05') {
					if (!getApp().globalData.stdOffsurEntBasic.creditCode) {

						uni.showToast({
							icon: "none",
							title: "经营主体信息不完整,身份属性【法定代表人】【股东】【实际控制人】无法选择！",
							duration: 2000
						})
						setTimeout(() => {
							this.stdOffsurSceneLoanRelation[index].ideyAttribute = null
						}, 50)

					}
				}

		

			},
			cardCheck(e, item, name) {

				setTimeout(() => {
					item[name] = e.target.value.replace(/[^\a-\z\A-\Z0-9]/g, '')
				}, 50)
			},
			
			add() {
				this.stdOffsurSceneLoanRelation.push({
					startDate:"",
					endDate:"",
					entStartDate:"",
					entEndDate:"",
					stdOffsurSlrReceiveAccount:[],
					stdOffsurCollateral:[],
					stdOffsurCars:[],
					auth:{isAuth:'未授权'},
					assetsAmount: '', //资产金额（元）
					businessId: "", //业务申请流水号
					createTime: "", //创建时间
					createUser: "", //创建人
					customerId: "", //客户编号
					customerSystemId: "", //客户系统编号
					debtAmount: '', //负债金额（元）
					deleteFlag: "", //删除标志
					entityRoleType: "", //数据归属类型
					exComments: "", //详情
					famAddress: "", //家庭住址
					getDatTime: "", //数据加载时间
					idCode: "", //身份证号码/统一社会信用代码
					ideyAttribute: "", //身份属性
					imageUrl: "", //影像路径
					incomeYear: '', //年收入（元）
					isGuarantee: "", //是否担保人
					marStatus: "10", //婚姻状况
					orgAddress: "", //工作单位地址
					orgAndDuty: "", //工作单位及职务
					relName: "", //姓名
					relationship: "", //与借款人关系
					reqId: "", //业务申请序号
					sourceSystem: "", //数据来源系统
					subjectType: "1", //主体类型 自然人
					telephone: "", //联系电话
					updateTime: "", //更新时间
					updateUser: "", //更新人
					uuid: "" //uuid
				})
			},
			add2() {
				this.stdOffsurSceneLoanRelation.push({
					startDate:"",
					endDate:"",
					entStartDate:"",
					entEndDate:"",
					stdOffsurSlrReceiveAccount:[],
					stdOffsurCollateral:[],
					stdOffsurCars:[],
					auth:{isAuth:'未授权'},
					legalIdCode:'',
					assEntFlag: false,
					legalPerson: '',
					assetsAmount: '', //资产金额（元）
					businessId: "", //业务申请流水号
					createTime: "", //创建时间
					createUser: "", //创建人
					customerId: "", //客户编号
					customerSystemId: "", //客户系统编号
					debtAmount: '', //负债金额（元）
					deleteFlag: "", //删除标志
					entityRoleType: "", //数据归属类型
					exComments: "", //详情
					famAddress: "", //家庭住址
					getDatTime: "", //数据加载时间
					idCode: "", //身份证号码/统一社会信用代码
					ideyAttribute: "", //身份属性
					imageUrl: "", //影像路径
					incomeYear: '', //年收入（元）
					isGuarantee: "", //是否担保人
					marStatus: "", //婚姻状况
					orgAddress: "", //工作单位地址
					orgAndDuty: "", //工作单位及职务
					relName: "", //姓名
					relationship: "", //与借款人关系
					reqId: "", //业务申请序号
					sourceSystem: "", //数据来源系统
					subjectType: "2", //主体类型 企业
					telephone: "", //联系电话
					updateTime: "", //更新时间
					updateUser: "", //更新人
					uuid: "" //uuid
				})
			},
			//查看二维码
			qcode(item) {
				console.log(item)
				this.tobeAuthType = item.tobeAuthType
				this.authedTax = item.authedTax
				this.isAuth = item.isAuth
				this.val = ''
				this.val2 = ''
				this.val = getApp().globalData.toUrl + '?reqId=' + getApp().globalData.stdOffsurBaiscInfo.reqId +
					'&&tobeId=' + item.id + '&&tobeAuthType=' + item.tobeAuthType +
					'&&customerType=' + item.customerType + '&&entityRoleType=' + item.entityRoleType + '&&customerName=' +
					item.customerName
				this.val2 = getApp().globalData.toUrl + '?reqId=' + getApp().globalData.stdOffsurBaiscInfo.reqId +
					'&&tobeId=' + item.id + '&&offsurRelation=' +item.offsurRelationId + '&&checkPass=2&&subjectFlag=2'  + '&&tobeAuthType=' + item.tobeAuthType
				this.$refs.popup.open()
				console.warn(this.val)
				setTimeout(() => {
					
					// 新增授权二维码
					if(this.tobeAuthType==='3'){
						this.$refs.qrcode2._makeCode()
					}else{
						this.$refs.qrcode._makeCode()
					}
					
				}, 500)

			},
			pclick(item) {
				
				if(this.tobeAuthType==='3'){
					this.$refs.qrcode2._clearCode()
				}else{
					this.$refs.qrcode._clearCode()
				}
				
				this.$refs.popup.close();
			},
			look(item){
				// /offsur/query/subjectData
				this.sendRequest({
					url: 'offsur/query/subjectData',
					method: 'post',
					hideLoading: false,
					data: {
						reqID:getApp().globalData.reqId,
						customerSystemId:item.customerSystemId,
						customerType:item.customerType,
						queryType:'01',
						type:'pad'
					},
					complete: (res2) => {
						console.log(res2)
						if (res2.code == '200') {
							if (!res2.data) {
								uni.showToast({
									icon: "none",
									title: '获取失败，请重试',
									duration: 2000
								})
							} else {
								this.$refs.popups.open()
								let html = res2.data.credit.htmlMessage
								this.zxbg = html
							}
			
						} else {
							uni.showToast({
								icon: "none",
								title: res2.message,
								duration: 2000
							})
						}
					}
				})
				
			},
			look2(item){
				// /offsur/query/subjectData
				this.sendRequest({
					url: 'offsur/query/subjectData',
					method: 'post',
					hideLoading: false,
					data: {
						 reqID:getApp().globalData.reqId,
						 customerSystemId:item.customerSystemId,
						 customerType:item.customerType,
						 queryType:'02',
						 type:'pad'
					},
					complete: (res2) => {
						console.log(res2)
						if (res2.code == '200') {
							if (!res2.data) {
								uni.showToast({
									icon: "none",
									title: '获取失败，请重试',
									duration: 2000
								})
							} else {
								// 表头处理
								let col = res2.data.basic.col
								for(let i=0;i<col.length;i++){
									 col[i].width = 200
								}
								this.col =col
								this.tableData =res2.data.basic.data
								let col2 = res2.data.income.col
								// for(let i=0;i<col2.length;i++){
								// 	 col2[i].width = 120
								// }
								this.col2 =col2
								this.tableData2 =res2.data.income.data
								let col3 = res2.data.vat.col
								this.col3 =col3
								this.tableData3 =res2.data.vat.data
								
								this.$refs.popup3.open()
								
							}
				
				
						} else {
							uni.showToast({
								icon: "none",
								title: res2.message,
								duration: 2000
							})
						}
					}
				})
				
			},
			save(item) {
				//console.log(item)
				if (!item.relName) {
					uni.showToast({
						title: '担保：' + item.relName +
							',名称不能为空！',
						icon: "none",
						duration: 2000
					})
					return false
				}
				if (!item.telephone) {
					uni.showToast({
						title: '担保：' + item.relName + ',手机号不能为空！',
						icon: "none",
						duration: 2000
					})
					return false
				}
				if (!item.idCode) {
					uni.showToast({
						title: '担保：' + item.relName +
							',证件号码不能为空！',
						icon: "none",
						duration: 2000
					})
					return false
				}
				if (!item.ideyAttribute) {
					uni.showToast({
						title: '担保：' + item.relName +
							',身份属性不能为空！',
						icon: "none",
						duration: 2000
					})
					return false
				}
				if(item.subjectType=='1'){
					if (!item.famAddress) {
						uni.showToast({
							title: '担保：' + item.relName +
								',家庭住址不能为空！',
							icon: "none",
							duration: 2000
						})
						return false
					}
					
					if (!item.marStatus) {
						uni.showToast({
							title: '担保：' + item.relName +
								',婚姻状况不能为空！',
							icon: "none",
							duration: 2000
						})
						return false
					}
					
					// 婚姻状况校验。
					if(item.marStatus==='20'){
						if(!item.maritalName||!item.maritalTelephone||!item.maritalOrg){
							uni.showToast({
								title: '请完善担保：' + item.relName +
									',配偶基本信息不能为空',
								icon: "none",
								duration: 2000
							})
							return false
						}
					}
					
				}
				
				// 202206反洗钱需求校验
				if(!item.endDate||!item.startDate){
					uni.showToast({
						title: '担保主体客户证件有效期不能为空',
						icon: "none",
						duration: 2000
					})
					return false
					
				}
				let nowDate= new Date().getTime()
				let endDate = new Date(item.endDate).getTime()
				let startDate = new Date(item.startDate).getTime()
				if(item.endDate!="长期"){
						
						if(nowDate>endDate){
							uni.showToast({
								title: '担保主体客户证件已过期，请核实并更新证件后提交！',
								icon: "none",
								duration: 2000
							})
							return false
						}
						if(nowDate<startDate){
							uni.showToast({
								title: '担保主体客户证件起始时间大于当前时间，请核实并更新证件后提交！',
								icon: "none",
								duration: 2000
							})
							return false
						}
				}else{
					if(nowDate<startDate){
						uni.showToast({
							title: '担保主体客户证件起始时间大于当前时间，请核实并更新证件后提交！',
							icon: "none",
							duration: 2000
						})
						return false
					}
				}
				
				if(item.subjectType=='2'){
					if(!item.legalIdCode){
						uni.showToast({
							title: '担保：' + item.relName +
								',法人证件号不能为空！',
							icon: "none",
							duration: 2000
						})
						return false
					}
					
					// 企业证件有效期
					if(!item.entEndDate||!item.entStartDate){
						uni.showToast({
							title: '担保主体客户证件有效期不能为空',
							icon: "none",
							duration: 2000
						})
						return false
						
					}
					
					let entEndDate = new Date(item.entEndDate).getTime()
					let entStartDate = new Date(item.entStartDate).getTime()
					if(item.entEndDate!="长期"){
							if(nowDate>entEndDate){
								uni.showToast({
									title: '担保主体客户证件已过期，请核实并更新证件后提交！',
									icon: "none",
									duration: 2000
								})
								return false
							}
							if(nowDate<entStartDate){
								uni.showToast({
									title: '担保主体客户证件起始时间大于当前时间，请核实并更新证件后提交！',
									icon: "none",
									duration: 2000
								})
								return false
							}
									
					}else{
						if(nowDate<entStartDate){
							uni.showToast({
								title: '担保主体客户证件起始时间大于当前时间，请核实并更新证件后提交！',
								icon: "none",
								duration: 2000
							})
							return false
						}
					}
				}
				
				// 证件有效期校验
				this.sendRequest({
					url: '/offsur/save_guarantee',
					method: 'post',
					hideLoading: false,
					data: {
						stdOffsurSceneLoanRelation: item,
						stdOffsurBaiscInfo: getApp().globalData.stdOffsurBaiscInfo,
						stdOffsursDelete: getApp().globalData.stdOffsursDelete,
					},
					complete: (res) => {
						console.log(res)
						if (res.code == '200') {
							item.uuid = res.data.offsurRelationId
							item.auth = res.data
							item.authFlag = '1'
							
							this.$emit('saveCache',true)
						} else {
							uni.showToast({
								icon: "none",
								title: res.message,
								duration: 2000
							})
						}
					}
				})

			},
			refresh(item){
				
				this.sendRequest({
					url: '/offsur/query_guarantee',
					method: 'post',
					hideLoading: true,
					data: {
						"reqId":getApp().globalData.stdOffsurBaiscInfo.reqId,
						 "offsurRelationId":item.auth.offsurRelationId
					},
					complete: (res) => {
						console.log(res)
						if (res.code == '200') {
							item.auth = res.data
						} else {
							uni.showToast({
								icon: "none",
								title: res.message,
								duration: 2000
							})
						}
					}
				})
			},
			selectXx(index, name, type,item,pindex) { //房讯通查询
				this.selectIndex = index
				this.selectName = name
				this.selectNode = pindex
				console.log(this.stdOffsurSceneLoanRelation[this.selectNode].stdOffsurCollateral[this.selectIndex][this.selectName])
				
			
				//接口评估房产
				//let item = this.stdOffsurCollateral01[index]
				console.log(item)
				let arr = item.mortgageAdd.split(',')
				//console.log(arr)
				if (type == 0) {
					if (item.mortgageAdd == '') {
						uni.showToast({
							icon: 'none',
							title: '请先选择资产所在地',
							duration: 2000
						})
						return false
					}
					if (item.buildingName == '') {
						uni.showToast({
							icon: 'none',
							title: '请先输入楼盘关键字',
							duration: 2000
						})
						return false
					}
			
					let data = {
						"areaId": arr[2],
						"cityId": arr[1],
						"key": item.buildingName
					}
					this.sendRequest({
						url: 'fxt/project',
						method: 'post',
						hideLoading: true,
						data: data,
						complete: (res) => {
							if (res.code == '0') {
								this.list0 = res.body
								this.$refs.Picker0.show() // 显示
							} else {
								//this.zcDisabled = false
								uni.showToast({
									icon: 'none',
									title: '楼盘获取失败，请重试',
									duration: 2000
								})
							}
			
						}
					})
			
				} else if (type == 1) {
					if (item.mortgageAdd == '') {
						uni.showToast({
							icon: 'none',
							title: '请先选择资产所在地',
							duration: 2000
						})
						return false
					}
					if (item.buildingName == '') {
						uni.showToast({
							icon: 'none',
							title: '请先输入楼盘名称',
							duration: 2000
						})
						return false
					}
					let data = {
						"areaId": arr[2],
						"buildingName": item.buildingNo,
						"cityId": arr[1],
						"floor": item.floor,
						"houseName": item.roomNo,
						"projectName": item.buildingName,
						"projectId": item.projectId
					}
					this.sendRequest({
						url: 'fxt/building',
						method: 'post',
						hideLoading: true,
						data: data,
						complete: (res) => {
							if (res.code == '0') {
								this.list = res.body
								this.$refs.Picker1.show() // 显示
							} else {
								//this.zcDisabled = false
								uni.showToast({
									icon: 'none',
									title: '楼栋号获取失败,请重试',
									duration: 2000
								})
							}
			
						}
					})
				} else {
					if (!item.buildingId) {
						uni.showToast({
							icon: 'none',
							title: '请先精准获取楼栋号',
							duration: 2000
						})
						return false
					}
					if (!item.floor) {
						uni.showToast({
							icon: 'none',
							title: '请输入楼层',
							duration: 2000
						})
						return false
					}
					let data = {
						"cityId": arr[1],
						"buildingId": item.buildingId,
						"floor": item.floor,
						"areaId": arr[2],
						"buildingName": item.buildingNo,
					}
					this.sendRequest({
						url: 'fxt/house',
						method: 'post',
						hideLoading: true,
						data: data,
						complete: (res) => {
							if (res.code == '0') {
								this.list2 = res.body
								this.$refs.Picker2.show() // 显示
							} else {
								//this.zcDisabled = false
								uni.showToast({
									icon: 'none',
									title: '房号获取失败,请重试',
									duration: 2000
								})
							}
			
						}
					})
				}
			},
			pg(item, index) {
				//接口评估房产
				let arr = item.mortgageAdd.split(',')
				let data = {
					"areaId": arr[2],
					"buildingName": item.buildingNo,
					"cityId": arr[1],
					"floor": item.floor,
					"houseName": item.roomNo,
					"projectName": item.buildingName,
					buildArea: item.area,
					projectId: item.projectId,
					buildingId: item.buildingId,
					houseId: item.buildingId
			
				}
				this.sendRequest({
					url: 'fxt/enquiry',
					method: 'post',
					hideLoading: true,
					data: data,
					complete: (res) => {
			
						if (res.code == '0') {
							item.autoAssessPrice = res.body.totalPrice
						} else {
							uni.showToast({
								icon: 'none',
								title: res.message || "评估失败",
								duration: 2000
							})
						}
					}
				})
			},
			
			// 最高额合同
			selectMaxGuaContract(e) {
				this.maxGuaContract = e.detail.value
				getApp().globalData.stdOffsurBaiscInfo.maxGuaContract = e.detail.value
			},
			atmblur(e, item) {
				console.log(e, item.avaiGurtAmt) //需求变更，正常1申请进行校验 最高maxGurtAmt
				//最新需求
				if (Number(e) > Number(item.maxGurtAmt)) {
					uni.showToast({
						icon: 'none',
						title: '拟申请占用金额不能高于引入的最高额担保合同金额！',
						duration: 2500
					})
					item.applOccupyAmt = ''
			
					return false
				}
				//拟占用金额不能为0
				if (e === '0') {
					uni.showToast({
						icon: 'none',
						title: '拟申请占用金额不能为0！',
						duration: 2500
					})
					item.applOccupyAmt = ''
			
					return false
			
				}
			
			},			
			//查询合同编号
			getContract() {
			
				if (this.contractId == '') {
					uni.showToast({
						icon: 'none',
						title: '请先输入合同编号！',
						duration: 2000
					})
					return false
				}
				this.sendRequest({
					url: 'loanBaseInfo/getGurContractInfo',
					method: 'post',
					hideLoading: false,
					data: {
						reqId: getApp().globalData.reqId,
						contractId: this.contractId
					},
					complete: (res) => {
						if (res.code == '200') {
			
							let flag = this.stdOffsurGnrContract.find(item => item.contractId == this
								.contractId)
							if (!flag) {
								this.stdOffsurGnrContract.push(res.data)
							} else {
								uni.showToast({
									icon: 'none',
									title: '合同已存在！',
									duration: 2500
								})
							}
			
						} else {
							uni.showToast({
								icon: 'none',
								title: res.message,
								duration: 2500
							})
						}
			
					}
				})
			},
			
		}
	}
</script>

<style lang="scss" >
	.title-column-item{
		width: 0;
	}
	.btn {
		margin: 1rem;

		button {
			margin-right: 2rem;
		}
	}

	.zx {
		width: 200rem;
		height: 100rem;
	}
	.qcode {
		width: 120rem;
		height: 75rem;
		text-align: center;
	
		uni-image {
			width: 100%;
			height: 100%;
		}
	
		image {
			width: 100%;
			height: 100%;
		}
		.qcodeCont{
			display:flex;
			height:60rem;
			.cont{
				padding:2rem;
				width:100%;
				height:60rem;
			}
		}
	}
</style>
